<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Storage;

//重庆渝电内网接口
class SdfkApiController extends Controller
{
    private $AppKey = "B9LCFP8T";
    private $AppSecret = "2500b91d82922ffecd7560a65cd442830bfc4d9";
//    private $BaseUrl = "https://mes-tool-dev.tunnel.shunjiantech.cn";
//    private $BaseUrl = "https://mes-tool-cq-dev.tunnel.shunjiantech.cn";
    // private $BaseUrl = "http://192.168.2.111";
    private $orgId = 1;
    private $status = 2;
    private $BaseUrl = "http://ip:port/";

    //查询风控平台存量工器具试验送检待检安全工器具信息
    public function getGqjBookTestInfo(){
        $url = $this->BaseUrl.'/rmcp-gqj-web/syzx/getGqjBookTestInfo';
        $postData = [
            'orgId'=>$this->orgId,
            'status'=>$this->status,
        ];
        $postData = json_encode($postData);
        return curl($url, $postData);
    }

    //获取风控平台新购置工器具试验送检待检安全工器具信息
    public function getGqjStock(){
        $url = $this->BaseUrl.'/rmcp_gqj_web/syzx/getGqjStock';
        $postData = [
            'orgId'=>$this->orgId,
            'status'=>$this->status,
        ];
        $postData = json_encode($postData);
        return curl($url, $postData);
    }

    //检测存量工器具送检安全工器具试验结果保存
    public function getGqjStock($bookid,$sendmechanism,$testList){
        $url = $this->BaseUrl.'/rmcp_gqj_web/saveGqjBookTestInfo';
        $postData = [
            'orgId'=>$this->orgId,
            'status'=> 1,
            'bookid'=>$bookid,
            'sendmechanism'=>$sendmechanism,
            'testList'=>$testList,
        ];
        $postData = json_encode($postData);
        return curl($url, $postData);
    }

    //检测存量工器具送检安全工器具试验结果保存
    public function getGqjStock($bookid,$sendmechanism,$testList){
        $url = $this->BaseUrl.'/rmcp_gqj_web/saveGqjBookTestInfo';
        $postData = [
            'status'=> 1,
            'bookid'=>$bookid,
            'sendmechanism'=>$sendmechanism,
            'testList'=>$testList,
        ];
        $postData = json_encode($postData);
        return curl($url, $postData);
    }

    // 检测新购置安全工器具试验结果保存
    public function saveStockTestInfo($bookid){
        $url = $this->BaseUrl.'/rmcp_gqj_web/saveStockTestInfo';
        $postData = [
            'status'=> 1,
            'bookid'=>$bookid,
            'sendmechanism'=>$sendmechanism,
            'testList'=>$testList,
        ];
        $postData = json_encode($postData);
        return curl($url, $postData);
    }

}
